package com.liezh.decorator.data;

import com.liezh.decorator.data.decorators.CompressionDataDecorator;
import com.liezh.decorator.data.decorators.DataLoaderDecorator;
import com.liezh.decorator.data.decorators.EncryptionDataDecorator;

/**
 * @author liezh
 * @date 2021-10-27
 */
public class Main {
    public static void main(String[] args) {
        String data = "Hallow World! :)";
        DataLoader dataLoader = new BaseDataLoader("demo.txt");
        DataLoaderDecorator decorator = new CompressionDataDecorator(new EncryptionDataDecorator(dataLoader));
        decorator.write(data);
        String output = decorator.read();
        System.out.println(output);
    }
}
